/**
 * 
 */
package profile.report;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @author ductrung.tran
 *
 */
public class ContextResultReport {

	private String name;
	
	private Map<String, StoreResultReport> storeResultReportMap = new HashMap<String, StoreResultReport>();

	public void setName(String name) {
		this.name = name;
	}

	public void addStoreResultReport(StoreResultReport storeResultReport) {
		storeResultReportMap.put(storeResultReport.getStore(), storeResultReport);
	}

	public String getName() {
		return name;
	}

	public StoreResultReport getStoreResultReport(String store) {
		return storeResultReportMap.get(store);
	}

	@Override
	public String toString() {
		return name + "\n" + resultReportsToString();
	}

	private String resultReportsToString() {
		StringBuilder builder = new StringBuilder();
		for (StoreResultReport testResultReport : storeResultReportMap.values()) {
			builder.append(testResultReport.toString(1)).append('\n');
		}
		return builder.toString();
	}
	
	public Collection<StoreResultReport> getStoreResultReports() {
		return storeResultReportMap.values();
	}
}
